{include file="public/header" /}





<div class="page">
    <div class="fixed-bar">
        <div class="item-title">
            <div class="subject">
                <h3>{$Think.lang.ds_supplier}</h3>
                <h5></h5>
            </div>
            {include file="public/admin_items" /}
        </div>
    </div>
  <div class="homepage-focus" dstype="editStoreContent">
      <ul class="tab-menu">
          <li class="current">{$Think.lang.store_info}</li>
      </ul>
      <form id="joinin_form" enctype="multipart/form-data" method="post" action="{:url('Supplier/update_save_joinin')}" style="display:none;">
          <input type="hidden" name="member_id" value="" />
          <!--账号信息-->
          <table  border="0" cellpadding="0" cellspacing="0" class="store-joinin ds-default-table">
              <thead>
              <tr>
                  <th colspan="2">系统账号信息：</th>
              </tr>
              </thead>
              <tbody>
              <tr>
                  <th class="w150">{$Think.lang.merchant_account}：</th>
                  <td class="item-text">
                      <input type="text" id="member_name" name="member_name"  class="w300" placeholder={$Think.lang.login_register_username_to_login}/>
                  </td>
              </tr>


              <tr>
                  <th class="w150">{$Think.lang.merchant_pwd}：</th>
                  <td><input id="merchant_pwd"  name="member_password" type="text"
                             class="w300"/>
                      <span></span>
                      <p style="color: #777;
    clear: both;
    margin-top: 10px;font-size: 0.8em;color: #F30"  class="emphasis">{$Think.lang.merchant_pwd1}</p></td>
              </tr>
            </tbody>
          </table>

          <!--运营商经营信息-->
          <table  border="0" cellpadding="0" cellspacing="0" class="store-joinin ds-default-table">
              <thead>
              <tr>
                  <th colspan="2">授信信息：</th>
              </tr>
              </thead>
              <tbody>
                  <tr>
                      <th class="w150">授信额度：</th>
                      <td class="item-text">
                          <input type="number" id="credit_num" name="credit_num"  class="w300" placeholder='请输入授信额度'/>

                      </td>
                  </tr>
                  <tr>
                      <th class="w150">授信天数：</th>
                      <td class="item-text">
                          <input type="number" id="credit_day" name="credit_day"  class="w300" placeholder='请输入授信天数'/>

                      </td>
                  </tr>

                  <tr>
                      <th class="w150">期初未开票金额：</th>
                      <td class="item-text">
                          <input type="number" id="invocie_money" name="invocie_money"  class="w300" placeholder='请输入期初未开票金额'/>

                      </td>
                  </tr>
                  <tr>
                      <th class="w150">期初未欠款金额：</th>
                      <td class="item-text">
                          <input type="number" id="debt_money" name="debt_money"  class="w300" placeholder='请输入期初未欠款金额'/>

                      </td>
                  </tr>
              </tbody>
          </table>
          <!--运营商经营信息-->
          <table  border="0" cellpadding="0" cellspacing="0" class="store-joinin ds-default-table">
              <thead>
              <tr>
                  <th colspan="2">运营商经营信息：</th>
              </tr>
              </thead>
              <tbody>
              <tr>
                  <th class="w150">运营商类别：</th>
                  <td class="item-text">
                      <select name="supplier_type" id="supplier_type">
                          <option value="">请选择运营商类别</option>
                          <option value="1">加价运营商</option>
                          <option value="0">提成运营商</option>
                      </select>
                  </td>
              </tr>

              <!--运营商类型-->
              <tr>
                  <th class="w150">{$Think.lang.store_type}：</th>
                  <td class="item-text">
                      <select name="store_type" id="store_type">
                          <option value="0">请选择</option>
                          {notempty name="class_list"}
                          {foreach $class_list as $key => $val}
                          <option value="{$val['storeclass_id']}">{$val['storeclass_name']}</option>
                          {/foreach}
                          {/notempty}
                      </select>
                  </td>
              </tr>
              <!--运营商类型结束-->
              </tbody>
          </table>

          <table border="0" cellpadding="0" cellspacing="0" class="store-joinin ds-default-table">
              <thead>
                  <tr>
                      <th colspan="6">{$Think.lang.store_and_contact_info}</th>
                  </tr>
              </thead>
              <tbody>
                  <tr>
                      <th>{$Think.lang.company_name}：</th>
                      <td><input type="text" class="txt" name="company_name" id="company_name"></td>
                      <th>{$Think.lang.company_location}：</th>
                      <td style="width: 483px;"><input type="hidden" name="company_address" id="company_address" ></td>
                      <th>{$Think.lang.company_address}：</th>
                      <td colspan="3"><input type="text" class="txt w300" name="company_address_detail" ></td>
                  </tr>
                  <tr>
                      <th>{$Think.lang.legal_person}：</th>
                      <td><input type="text" class="txt" id="legal_person" name="legal_person" ></td>
                      <th>{$Think.lang.legal_person_phone}：</th>
                      <td><input type="text" name="legal_person_phone" id="company_address" ></td>
                      <th>{$Think.lang.contact_name}：</th>
                      <td colspan="3"><input type="text" class="txt w300" name="contacts_name" ></td>
                  </tr>
                  <tr>
                      <th>{$Think.lang.contact_number}：</th>
                      <td><input type="text" class="txt" name="contacts_phone" ></td>
                      <th>{$Think.lang.contact_phone}：</th>
                      <td><input type="text" class="txt" name="contact_legal_phone" ></td>
                      <th>{$Think.lang.contact_qq}：</th>
                      <td><input type="text" class="txt" name="contact_qq" ></td>

                  </tr>
                  <tr>
                      <th>{$Think.lang.e_mail}：</th>
                      <td><input type="text" class="txt" name="contacts_email" ></td>
                  </tr>
              </tbody>
          </table>
          <table border="0" cellpadding="0" cellspacing="0" class="store-joinin ds-default-table">
              <thead>
                  <tr>
                      <th colspan="20">{$Think.lang.business_license_information}</th>
                  </tr>
              </thead>
              <tbody>
                  <tr>
                      <th class="w150">{$Think.lang.business_license_number}：</th>
                      <td><input type="text" class="txt" name="business_licence_number" ></td></tr><tr>

                      <!-- <th class="w150">{$Think.lang.duty_paragraph}：</th>
                      <td><input type="text" class="txt" name="duty_paragraph" ></td></tr><tr>

                      <th class="w150">{$Think.lang.credit_code}：</th>
                      <td><input type="text" class="txt" name="credit_code" ></td></tr><tr> -->

                      <th>{$Think.lang.place_business_license}：</th>
                      <td><input type="hidden" name="business_licence_address" id="business_licence_address" ></td></tr><tr>

                      <th>{$Think.lang.validity_business_license}：</th>
                      <td><input type="text" class="txt" name="business_licence_start" id="business_licence_start" > - <input type="text" class="txt" name="business_licence_end" id="business_licence_end" ></td>
                  </tr>
                  <tr>
                      <th>{$Think.lang.legal_scope_business}：</th>
                      <td colspan="20"><input type="text" class="txt w300" name="business_sphere" ></td>
                  </tr>
                  <tr>
          <th>
          {$Think.lang.business_license}{$Think.lang.electronic_version}：</th>
          <td><input name="business_licence_number_electronic" type="file" class="w200" />
            <br>
            <span style="color: #777;
    clear: both;
    margin-top: 10px;font-size: 0.8em;" class="block">{$Think.lang.upload_information2}</span></td>
        </tr>
              </tbody>
          </table>


          <table border="0" cellpadding="0" cellspacing="0" class="store-joinin ds-default-table">
              <thead>
                  <tr>
                      <th colspan="2">系统账号信息：</th>
                  </tr>
              </thead>
              <tbody>
                  <tr>
                      <th>{$Think.lang.bank_account_name}：</th>
                      <td><input type="text" class="txt w300" name="settlement_bank_account_name" ></td>
                  </tr>
                  <tr>
                      <th>{$Think.lang.bank_account_number}：</th>
                      <td><input type="text" class="txt w300" name="settlement_bank_account_number" ></td>
                  </tr>

                  <tr>
                      <th>{$Think.lang.bank_name}：</th>
                      <td><input type="text" class="txt w300" name="settlement_bank_name" ></td>
                  </tr>

                  <tr>
                      <th>{$Think.lang.bank_address}：</th>
                      <td><input type="text" class="txt w300" name="settlement_bank_address" ></td>
                  </tr>
              </tbody>

          </table>


      <tfoot>
        <tr>
          <td colspan="20">&nbsp;</td>
        </tr>
      </tfoot>
    </table>

          <div><input class="btn join_submit" type="submit" value="{$Think.lang.ds_submit}"/></div>
      </form>
</div>
</div>
<link rel="stylesheet" href="{$Think.PLUGINS_SITE_ROOT}/js/jquery.lightbox/css/lightbox.min.css">
<script src="{$Think.PLUGINS_SITE_ROOT}/js/jquery.lightbox/js/lightbox.min.js"></script>
<script type="text/javascript">
$(function(){
    function nosubmit(c) {
        $(c).attr('disabled', 'true');
        $(c).css('background', '#eee');
    }
    function delnosubmit(c) {
        $(c).removeAttr('disabled');
        $(c).css('background', '');
    }
    // 用户名检测
    $('[name="settlement_bank_account_name"]').blur(function () {
        var val = $(this).val();
        if (!val) {
            nosubmit('.join_submit');
            layer.msg('银行开户名必须填写');
        } else {
            delnosubmit('.join_submit');
        }
        if (val.length <= 2) {
            nosubmit('.join_submit');
            layer.msg('银行开户名不能小于两个字符');
        } else {
            delnosubmit('.join_submit');
        }
        var pattern = /^[0-9]*$/;
        if (pattern.test(val)) {
            nosubmit('.join_submit');
            layer.msg('银行开户名不能为纯数字')
        } else {
            delnosubmit('.join_submit');
        }

    })
    // 银行卡位数
    $('[name="settlement_bank_account_number"]').blur(function () {
        var val = $(this).val();
        /**
         * 百度知道
         * 1、15位存折账号；
         2、16位卡号：有银联或VISA/MASTERCard标志的（包括普通一卡通、银联金卡/葵花卡、国际借记卡、IC卡、M+卡等）；
         3、12位老卡：较早开户的账户，4位城市区号+8位账号，如城市区号不足4位，首位以0补足；
         4、19位卡号：TOUCH卡（现已停止使用一卡通开通手机TOUCH卡）
         */
        if (val.length < 12 || val.length > 19) {
            nosubmit('.join_submit');
            layer.msg('请输入正确的银行卡号');
        } else {
            delnosubmit('.join_submit');
        }
    })
    // 联系人手机号
    $('[name="contact_legal_phone"]').blur(function () {
        var val = $(this).val();
        var pattern = /^(13[0-9]|14[5|7]|15[0|1|2|3|4|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\d{8}$/;
        if (!pattern.test(val)) {
            nosubmit('.join_submit');
            layer.msg('请输入正确的手机号')
        } else {
            delnosubmit('.join_submit');
        }
    })
    // 电子邮箱
    $('[name="contacts_email"]').blur(function () {
        var val = $(this).val();
        var pattern = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
        if (!pattern.test(val)) {
            nosubmit('.join_submit');
            layer.msg('邮箱格式不正确')
        } else {
            delnosubmit('.join_submit');
        }
    })
    $("#company_address").ds_region();
    $("#business_licence_address").ds_region();
    $("#bank_address").ds_region();
    $("#settlement_bank_address").ds_region();
    $('#end_time').datepicker({dateFormat: 'yy-mm-dd'});
    $('#business_licence_start').datepicker({dateFormat: 'yy-mm-dd'});
    $('#business_licence_end').datepicker({dateFormat: 'yy-mm-dd'});

    $.validator.addMethod("nostring", function(value, element, params){
        console.log(value);
        var pattr = /^[0-9]+$/;
        if (pattr.test(value)) {
            // layer.msg('不能是数字')
            return false;
        }
        return true;
    }, '不能是数字');

       $("#joinin_form").validate({
            errorPlacement: function (error, element) {
                var error_td = element.parent('.item-text');
                error_td.append(error);
                element.parents('.item:first').addClass('error');
            },

            rules: {
                member_name: {
                    required: true,
                    minlength: 3,
                    maxlength: 15,
                    remote: {
                        url: HOMESITEURL + '/Login/check_member.html',
                        type: 'get',
                        data: {
                            user_name: function () {
                                return $('#member_name').val();
                            }
                        }
                    },
                },
                company_name: {
                    required: true,
                    
                },
                legal_person: {
                    required: true,
                },
                supplier_type: {
                    required: true,
                },
            },
            messages: {
                member_name: {
                    required: '{$Think.lang.login_register_input_username}',
                    minlength: '{$Think.lang.login_register_username_range}',
                    maxlength: '{$Think.lang.login_register_username_range}',
                    remote: '{$Think.lang.login_register_username_exists}'
                },
                company_name: {
                    required: '企业名称不能为空',
                },
                legal_person: {
                    required: '法人姓名不能为空',
                },
                supplier_type: {
                    required: '运营商类别不能为空',
                },
            }
        });

    $(this).addClass('current').siblings().removeClass('current');
    var _index = $(this).index();
    var _form = $('div[dstype="editStoreContent"]').find('form');
    _form.hide();
    _form.eq(_index).show();

});
</script>
